package com.atguigu03.threadsafe.runnablesafe.ex;

public class Account {
    private int balance;

    public Account(int balance) {
        this.balance = balance;
    }

    public Account() {

    }

    public int getBalance() {
        return balance;
    }

    public void setBalance(int balance) {
        this.balance = balance;
    }

    public  void deposit(int a){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        balance+=a;
        System.out.println(Thread.currentThread().getName()+"存钱 "+"余额为："+balance);
    }
}
